package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.result.EUTreeNodeResult;
import com.taotao.common.result.TaotaoResult;
import com.taotao.service.ContentCatService;

@Controller
@RequestMapping("/content")
public class ContentCatController {
	@Autowired
	private ContentCatService contentCatService;
	@RequestMapping("/category/list")
	@ResponseBody
	public List<EUTreeNodeResult> contentCatList(
			@RequestParam(value="id",defaultValue="0") Long parentId)throws Exception{
		List<EUTreeNodeResult> list=contentCatService.getContentCatList(parentId);
		return list;
	}
	@RequestMapping("/category/create")
	@ResponseBody
	public TaotaoResult addNode(Long parentId,String name)throws Exception{
		TaotaoResult result=contentCatService.addNode(parentId, name);
		return result;
	}
}
